export default {

    setFileList(fileinfo) {
        let fileList = [];
        if (fileinfo) {
            let arr = JSON.parse(fileinfo);
            arr.forEach((item, index) => {
                let obj = {
                    name: item.name,
                    url: localStorage.getItem("baseURL") + item.url
                };
                fileList.push(obj);
            });
        }
        return fileList;
    },

    setElImage(fileinfo) {
        let ret = [];
        if (fileinfo) {
            let arr = JSON.parse(fileinfo);
            arr.forEach((item) => {
                ret.push(localStorage.getItem("baseURL")+item.url);
            });
        }
        return ret;
    },

    getNowFormatDate() {
        var nowtime = new Date();
        var year = nowtime.getFullYear();
        var month = this.padleft0(nowtime.getMonth() + 1);
        var day = this.padleft0(nowtime.getDate());
        return year + "-" + month + "-" + day + " ";
    },

    padleft0(obj) {
        return obj.toString().replace(/^[0-9]{1}$/, "0" + obj);
    }

}